package wsi.subgraph;

import java.awt.Component;
import java.util.logging.Logger;

import org.rygh.gui.swing.component.MonitorContainer;

import wsi.function.DirManager;
import wsi.function.Function;
import wsi.function.FunctionController;
import wsi.function.Function.Phrase;

/**
 * for one service
 * 
 * @author nanmus
 * 
 */

@Deprecated
public class ExtractEngine extends MonitorContainer<String> {
	private final Logger log = Logger.getLogger(getClass().getName());

	public ExtractEngine(Component parent, Component action, String message) {
		super(parent, action, message);
	}

	public void process(boolean gui) {
		DirManager dir = null;

		for (Function f : FunctionController.shared().getAllFunctions()) {
			if (f.isSkipped(Phrase.YAGO_HOP))
				continue;

			log.info(String.format("processing %s/%s", f.getService(),
					f.getName()));
			dir = new DirManager(f);
			break;
		}

		if (dir == null)
			return;

		ExtractWorker yagoHop = new ExtractWorker(dir, this);

		if (gui) {
			setTask(yagoHop);
			run();
		} else
			yagoHop.process();
	}
}
